/*    */ package com.zimbra.cs.redolog.op;
/*    */ 
/*    */ import com.zimbra.cs.mailbox.Mailbox;
/*    */ import com.zimbra.cs.mailbox.MailboxManager;
/*    */ import com.zimbra.cs.mailbox.MailboxOperation;
/*    */ import com.zimbra.cs.redolog.RedoLogInput;
/*    */ import com.zimbra.cs.redolog.RedoLogOutput;
/*    */ import com.zimbra.cs.redolog.Version;
/*    */ import java.io.IOException;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class CreateComment
/*    */   extends RedoableOp
/*    */ {
/*    */   private int mItemId;
/*    */   private String mUuid;
/*    */   private int mParentId;
/*    */   private String mCreatorId;
/*    */   private String mText;
/*    */   
/*    */   public CreateComment()
/*    */   {
/* 36 */     super(MailboxOperation.CreateComment);
/*    */   }
/*    */   
/*    */   public CreateComment(int mailboxId, int parentId, String text, String creatorId) {
/* 40 */     this();
/* 41 */     setMailboxId(mailboxId);
/* 42 */     this.mParentId = parentId;
/* 43 */     this.mText = text;
/* 44 */     this.mCreatorId = creatorId;
/*    */   }
/*    */   
/*    */   public int getItemId() {
/* 48 */     return this.mItemId;
/*    */   }
/*    */   
/*    */   public String getUuid() {
/* 52 */     return this.mUuid;
/*    */   }
/*    */   
/*    */   public void setItemIdAndUuid(int itemId, String uuid) {
/* 56 */     this.mItemId = itemId;
/* 57 */     this.mUuid = uuid;
/*    */   }
/*    */   
/*    */   protected String getPrintableData() {
/* 61 */     StringBuilder sb = new StringBuilder("id=").append(this.mItemId);
/* 62 */     sb.append(", uuid=").append(this.mUuid);
/* 63 */     sb.append(", creator=").append(this.mCreatorId);
/* 64 */     sb.append(", text=").append(this.mText).append(", parentId=").append(this.mParentId);
/* 65 */     return sb.toString();
/*    */   }
/*    */   
/*    */   protected void serializeData(RedoLogOutput out) throws IOException {
/* 69 */     out.writeInt(this.mItemId);
/* 70 */     if (getVersion().atLeast(1, 37)) {
/* 71 */       out.writeUTF(this.mUuid);
/*    */     }
/* 73 */     out.writeInt(this.mParentId);
/* 74 */     out.writeUTF(this.mCreatorId);
/* 75 */     out.writeUTF(this.mText);
/*    */   }
/*    */   
/*    */   protected void deserializeData(RedoLogInput in) throws IOException {
/* 79 */     this.mItemId = in.readInt();
/* 80 */     if (getVersion().atLeast(1, 37)) {
/* 81 */       this.mUuid = in.readUTF();
/*    */     }
/* 83 */     this.mParentId = in.readInt();
/* 84 */     this.mCreatorId = in.readUTF();
/* 85 */     this.mText = in.readUTF();
/*    */   }
/*    */   
/*    */   public void redo() throws Exception {
/* 89 */     int mboxId = getMailboxId();
/* 90 */     Mailbox mbox = MailboxManager.getInstance().getMailboxById(mboxId);
/* 91 */     mbox.createComment(getOperationContext(), this.mParentId, this.mText, this.mCreatorId);
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/redolog/op/CreateComment.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */